package thread.produce_customer_base;

/**
 * Created by mHandler on 2018/6/2 0002.
 * Description:
 */
public class Producer {
    private String lock;

    public Producer(String lock){
        super();
        this.lock = lock;
    }
    public void setValue(){

        try {
            synchronized (lock){
                if (!ValueObject.value.equals("")){
                    lock.wait();
                }
                String value = System.currentTimeMillis()+" "+System.nanoTime();
                System.out.println("set的值是"+value);
                ValueObject.value = value;
                lock.notify();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
